<!DOCTYPE html>
<html lang="zh-CN" xmlns:v-for="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>10.v-for</title>
</head>
<body>
<div id="app">
    <!-- 遍历对象 -->
    <span v-for="value,key,index in user">
        {{index}}   {{key}}   {{value}} ,
    </span>
    <!-- 遍历数组 -->
    <ul>
        <li v-for="item,index in arr">{{index+1}} - {{item}}</li>
    </ul>
    <!-- 遍历对象数组
        :key 便于vue内部做重用和排序
    -->
    <ul>
        <li v-for="user,index in users" :key="user.name">
            {{index+1}}-{{user.name}}-{{user.age}}-{{user.content}}
        </li>
    </ul>
</div>
<script src="js/vue.js"></script>
<script>
    const app = new Vue({
        el:"#app",
        data:{
            user:{name:"konley",age:23},
            arr:["学校","宿舍","图书馆"],
            users:[
                {id:1,name:"cjh",age:23,content:"我是cjh"},
                {id:1,name:"cjy",age:12,content: "我是cjy"}
            ]
        }
    })
</script>
</body>
</html>